***************************the north-south disparity(Table 1,Table S8)*******************
* set path

	global path "~/agriculture_temperature"
	
	use $path/data/merged_for_reg, clear

	xtset ctycode year
	
	drop dd5bin10
	
* embeded formal test (interactive model)
	gen north = (region3!=2)
	
	foreach t in 5 {
		foreach x in aoutput farming_output forest_output livestock_output fishery_output {
			qui reghdfe ln_`x' c.north#c.dd5bin35 dd`t'bin* ///
					c.pre##c.pre c.ssd##c.ssd c.rhu##c.rhu c.prs##c.prs c.win##c.win ///
					i.pro#c.year##c.year ///
					if inrange(year,1995,2015) & inlist(region3,1,2), ///
					absorb(ctycode year) cluster(ctycode proXyear) 
			estimates store sntest1_`x'_`t'C
			}
		}
		
	foreach t in 5 {
		foreach x in aoutput farming_output forest_output livestock_output fishery_output {
			qui reghdfe ln_`x' c.north#c.dd5bin* dd`t'bin* ///
					c.pre##c.pre c.ssd##c.ssd c.rhu##c.rhu c.prs##c.prs c.win##c.win ///
					i.pro#c.year##c.year ///
					if inrange(year,1995,2015) & inlist(region3,1,2), ///
					absorb(ctycode year) cluster(ctycode proXyear) 
			estimates store sntest2_`x'_`t'C
			}
		}	
		
	foreach t in 5 {
		foreach x in aoutput farming_output forest_output livestock_output fishery_output {
			qui reghdfe ln_`x' c.north#c.dd5bin* dd`t'bin* ///
					c.north#c.pre##c.pre c.north#c.ssd##c.ssd c.north#c.rhu##c.rhu c.north#c.prs##c.prs c.north#c.win##c.win ///
					c.pre##c.pre c.ssd##c.ssd c.rhu##c.rhu c.prs##c.prs c.win##c.win ///
					i.pro#c.year##c.year ///
					if inrange(year,1995,2015) & inlist(region3,1,2), ///
					absorb(ctycode year) cluster(ctycode proXyear) 
			estimates store sntest3_`x'_`t'C
			}
		}			
			
	esttab sntest?_aoutput*, b(4) se(4) keep(*dd5bin*) star(* 0.1 ** 0.05 *** 0.01)

	esttab sntest?_farming_output*, b(4) se(4) keep(c.north#c.dd5bin35) star(* 0.1 ** 0.05 *** 0.01)
	esttab sntest?_forest_output*, b(4) se(4) keep(c.north#c.dd5bin35) star(* 0.1 ** 0.05 *** 0.01)
	esttab sntest?_livestock_output*, b(4) se(4) keep(c.north#c.dd5bin35) star(* 0.1 ** 0.05 *** 0.01)
	esttab sntest?_fishery_output*, b(4) se(4) keep(c.north#c.dd5bin35) star(* 0.1 ** 0.05 *** 0.01)
	
	estimates restore sntest2_aoutput_5C
	test  c.north#c.dd5bin25 = c.north#c.dd5bin30 = c.north#c.dd5bin35 = 0
	test  c.north#c.dd5bin30 = c.north#c.dd5bin35 = 0
	estimates restore sntest3_aoutput_5C
	test  c.north#c.dd5bin25 = c.north#c.dd5bin30 = c.north#c.dd5bin35 = 0	
	test  c.north#c.dd5bin30 = c.north#c.dd5bin35 = 0
			
